//
//  MBPoiSuggest.h
//  iNaviCore
//
//  Created by fanyunlong on 6/12/16.
//  Copyright © 2016 Mapbar. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "MBWmrBaseTypes.h"
#import "MBPoiBaseTypes.h"

typedef void (^MBPoiSuggestBasicBlock)(void);
/**
 *  查找失败闭包
 *
 *  @param err    错误码
 *  @param detail 错误详情
 */
typedef void (^MBPoiSuggestErrorBlock)(MBPoiSearchError err, NSString* detail);
/**
 *  查找成功闭包
 *
 *  @param pois               MBPoiItem
 *  @param corrections        MBCorrectionItem
 *  @param cityDistributions  MBCityDistributionItem
 *  @param citySuggestions    MBCitySuggestionItem
 *  @param districts          MBDistrict
 */
typedef void (^MBPoiSuggestDataBlock)(NSArray *pois, NSArray *corrections, NSArray *cityDistributions, NSArray *citySuggestions, NSArray *districts);

/**
 *  查找建议类
 */
@interface MBPoiSuggest : NSObject
/**
 *  获取默认的查找建议类
 *
 *  @return 实例
 */
+ (instancetype)defaultInstance;
/**
 *  服务器地址
 */
@property(nonatomic,retain)NSString* urlBase;
/**
 *  设置查找城市
 */
@property(nonatomic,retain)NSString* city;
/**
 *  设置搜索页大小
 */
@property (nonatomic, assign) NSInteger pageSize;
/**
 *  设置相关深度
 */
@property (nonatomic, assign) NSInteger relationDepth;
/**
 *  开始查找关键字
 *
 *  @param keyword 关键字
 */
-(void)queryByKeyword:(NSString*)keyword;
/**
 *  查找取消
 */
-(void)queryCancel;
/**
 *  设置查找开始的闭包
 *
 *  @param aStartedBlock 开始闭包
 */
- (void)setStartedBlock:(MBPoiSuggestBasicBlock)aStartedBlock;
/**
 *  设置查找结束闭包
 *
 *  @param aEndBlock 结束闭包
 */
- (void)setEndedBlock:(MBPoiSuggestBasicBlock)aEndBlock;
/**
 *  设置查找失败闭包
 *
 *  @param aFailedBlock 失败闭包
 */
- (void)setFailedBlock:(MBPoiSuggestErrorBlock)aFailedBlock;
/**
 *  设置查找成功闭包
 *
 *  @param aLoadedBlock 成功闭包
 */
- (void)setLoadedBlock:(MBPoiSuggestDataBlock)aLoadedBlock;
/**
 *  设置取消闭包
 *
 *  @param aCancelBlock 取消闭包
 */
- (void)setCanceledBlock:(MBPoiSuggestBasicBlock)aCancelBlock;
@end
